import { _decorator, Component, director, Label, Node } from 'cc';
import { emits } from '../data/enums';
import { gameConfig } from '../data/gameConfig';
const { ccclass, property } = _decorator;

@ccclass('top')
export class top extends Component {
    @property(Label)
    step: Label = null;
    //关卡标签
    @property(Label)
    level: Label = null;
    start() {
        this.init();
        director.on(emits.updateStep, this.addStep, this);
    }

    update(deltaTime: number) {
        
    }
    init(){
        this.level.string = `关卡${gameConfig.currentLevelNum}`;
    }
    addStep() {
        gameConfig.step++;
        this.step.string = gameConfig.step.toString();
    }
    clickPause(){
        director.emit(emits.gamePause);
    }
}


